<template>
  <div class="Component-panel-Dialog">
    <el-dialog title="提示" v-model="Dialogboolean" top="30vh" :close-on-click-modal="false" @close="closes">
      <div class="Component-panel-input">
        <div class="Component-msg">
          <span>{{ Msg }}</span>
        </div>
        <div class="Component-input">
          <el-input v-model="key"></el-input>
        </div>
      </div>
      <div class="Component-panel-Error" v-if="Tips.TipsErrorBoolean">
        <span>{{ Tips.TipsError }}</span>
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="Ready" :style="Buttonstyle">{{
            Buttonname
          }}</el-button>
          <el-button @click="Cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import { defineComponent, reactive, toRef, toRefs, ref } from "vue";
import { ElMessage, ElMessageBox } from 'element-plus'
export default defineComponent({
  name: "DialogComponentInput",
  components: {

  },
  props: {
    DialogComponent: {
      type: Object,
      default: "",
    },
  },
  setup(props, context) {
    let key = ref('')
    let { Dialogboolean, Speanstyles, Msg, Buttonstyle, Buttonname, Tips } = toRefs(props.DialogComponent)
    function Ready() {
      if (!key.value) {
        return ElMessageBox.alert('内容不能为空', '提示', {
          confirmButtonText: '确定',
        })
      } else {
        context.emit("click", "Ready");
        Tips.value.TipsError = ''
        Tips.value.TipsErrorBoolean = false
      }
    }
    function Cancel() {
      context.emit("click", "Cancel");
      key.value = ""
      Tips.value.TipsError = ''
      Tips.value.TipsErrorBoolean = false
    }
    function closes() {
      context.emit("click", "Cancel");
      key.value = ""
      Tips.value.TipsError = ''
      Tips.value.TipsErrorBoolean = false
    }
    return {
      Ready,
      Cancel,
      closes,
      Dialogboolean,
      Speanstyles,
      Buttonstyle,
      Buttonname,
      Msg,
      key,
      Tips,
    };
  },
});
</script>
<style lang="less">
.dialog-footer {
  margin-top: 5%;
}
/* 弹出框的宽高度 */
.Component-panel-Dialog .el-dialog {
  width: 640px !important;
  height: 380px;
  border-radius: 20px;
  // margin-top: 30vh;
}

.Component-panel-Dialog .el-input__inner {
  width: 460px;
  font-size: 24px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #1b1b1d;
}

.Component-panel-Dialog .el-dialog__body {
  padding: 100px 0px 0px 0px;
}

.Component-panel-Dialog .el-dialog__footer {
  padding: 65px 20px 20px 90px;
}

.Component-panel-Dialog .el-dialog__title {
  position: absolute;
  left: -25px;
  top: 25px;
  width: 149px;
  height: 23px;
  font-size: 24px;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: #81859c;
}

.Component-panel-Dialog .el-button {
  width: 200px;
  height: 60px;
  margin-right: 60px;
  font-size: 24px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  border-radius: 10px;
}

.Component-panel-Dialog .el-form-item__label {
  width: 42px;
  height: 17px;
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #81859c;
}

.Component-panel-Dialog .el-button span {
  color: #ffffff;
}

.Component-panel-span {
  width: 100%;
  height: 30px;
  font-size: 24px;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: #81859c;
  line-height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.Component-panel-Dialog .el-button:nth-child(2) {
  background: #81859c;
}

.Component-panel-input {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.Component-msg {
  width: 20%;
  height: 40px;
  font-size: 20px;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: #81859c;
  display: flex;
  align-items: center;
  justify-content: center;
}

.Component-input {
  width: 50%;
  min-height: 40px;
}

.Component-input .el-input__inner {
  width: 100%;
  min-height: 40px;
}

.Component-panel-Error {
  position: absolute;
  top: 50%;
  width: 100%;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: red;
  font-size: 20px;
  font-weight: 500;
}
</style>
